﻿using Microsoft.UI.Xaml.Markup;

namespace DimensionsHelper.Client.WinUi.Extensions;

public partial class SymbolIconExtension : MarkupExtension
{
    public FluentSystemIconSymbols Symbol
    {
        get;
        set;
    }


    public int FontSize
    {
        get;
        set;
    }


    public Brush? Foreground
    {
        get;
        set;
    }


    protected override object ProvideValue()
    {
        FontIcon icon = new()
        {
            FontFamily = FontHelper.FluentUiSystemFont,
            FontSize = 24,
            Width = 24,
            Height = 24,
            Glyph = char.ConvertFromUtf32((int)Symbol)
        };

        if (FontSize > 0)
        {
            icon.FontSize = FontSize;
        }

        if (Foreground != null)
        {
            icon.Foreground = Foreground;
        }

        return icon;
    }
}